﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PMC.States
{
    [Obsolete("Please use DLL's")]
    class CaptchaState : State
    {
        public CaptchaState(Wbrowser webbrowser) : base(webbrowser)
        {
        }

        public override void OnEntry()
        {
            HtmlElementCollection HtmlCollection = GetCollection("a");
            foreach (HtmlElement el in HtmlCollection)
            {
                if (el.GetAttribute("href").Contains("runner.php?KE="))
                    WebBrowser.CaptchaList.Enqueue(new Uri(el.GetAttribute("href")));
            }
        }

        public override void DoAction()
        {
            if (WebBrowser.CaptchaList.Count > 0)
                WebBrowser.Next();
            else
                WebBrowser.Transition(WebBrowser.NormalState, WebBrowser.PaidMailList);
        }
    }
}
